#ifndef GROUNDSPEEDVECTOR_H
#define GROUNDSPEEDVECTOR_H

#include <cmath>

class GroundSpeedVector
{
public:
	GroundSpeedVector(double speed_north, double speed_east) : speed_(0.0), course_(0.0)
	{
		speed_ = sqrt(speed_north * speed_north + speed_east * speed_east);

		if (speed_ > 0.01)
		{
			course_ = acos(speed_north / speed_) * 180.0 / 3.14159265;
			if (speed_east < 0)
				course_ = 360.0 - course_;
		}
	}

	double getSpeed(void) const {return speed_;}
	double getCourse(void) const {return course_;}

private:
	GroundSpeedVector(void);	// default ctor disabled
	
	double speed_;
	double course_;
};

#endif
